package com.yuntu.controller;

import com.yuntu.entity.Person;
import com.yuntu.service.PersonService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @Author 张甲升
 * @create 2021-11-05-9:25
 */
@RestController
@RequestMapping("/person")
@CrossOrigin //跨域
public class PersonController {
    @Resource
    private PersonService personService;

    @GetMapping("/query")
    public List<Person> query(){
        List<Person> list = personService.query();
        return list;
    }

    @PostMapping("/insert")
    public int insert(@RequestBody Person person){
        System.out.println("chulai"+person.toString());
        return personService.insert(person);
    }

    @GetMapping("/delete")
    public int delete(int id){
        return personService.delete(id);
    }
}
